package com.gxa.admin.recycling.controller;

import com.gxa.admin.recycling.service.MenuService;
import com.gxa.core.recycling.common.JsonResult;
import com.gxa.core.recycling.pojo.Menu;
import io.swagger.annotations.Api;
import io.swagger.annotations.ApiImplicitParam;
import io.swagger.annotations.ApiOperation;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.transaction.annotation.Transactional;
import org.springframework.web.bind.annotation.PostMapping;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RequestParam;
import org.springframework.web.bind.annotation.RestController;

import java.util.List;
import java.util.Map;

/**
 * @author R
 * @data 2021-12-02 14:16
 */
@RestController
@RequestMapping("/menu")
@Api(tags = "角色权限表")
@Transactional(rollbackFor = Throwable.class)
public class MenuController {

    @Autowired
    MenuService service = null;

    @PostMapping("/getAllMenus")
    @ApiOperation("查询所有的权限列表")
    public Map getAllMenus(){
        List<Menu> allMenus = service.getAllMenus();
        JsonResult jsonResult = new JsonResult();
        jsonResult.setCode("200");
        jsonResult.setMsg("查询成功");
        jsonResult.setData(allMenus);
        return jsonResult.getDataMap();
    }
}
